The Validation Feature |
|
In most cases, the data that you enter in an XForm needs to be validated before saving it to the database. Validating data ensures that only correct data is sent and saved in the database. Validations can also be used as a means to sequence the appropriate course of action in a process in which varied possibilities exist. For example, depending on user selection, you can use validation to decide which screens to display in a wizard. You can also use validation to provide conditional access to information such as limiting access for a particular role profile.
Validation Types
Process Platform provides the following types of validations:
- Data-type based validation
- Server side validation
- Custom validation
Data-type based validation
This type of validation is done on the client side and specifies the type of data to be displayed in a control. For example, you can set validation on a control to receive only date values.
You can apply Data-type validation in the following ways:
Automatic: When using Web services to create an XForm, the validations defined in the WSDL are automatically applied to the respective controls. For example, if the WSDL defines the input values for a control as integer, the control will not accept any value other than an integer.
Manual: By specifying the data type of the control in the Formatting Options dialog box. For information about specifying data types for controls, see Formatting and Validating Controls.
Server side validation
The integration of WS-AppServer with XForms makes it possible to define validations on the server side. You can use the business logic defined in the server to validate data in XForms. You can control and customize the validation constraints using the events provided for integration. For information about the XForms-WS-AppServer integration, see Integrating with WS-AppServer.
Custom validation
In addition to the validations specified by data type and business logic, you can also define custom validations. Custom validations are applied after the client and server validations are performed. The use of custom validations gives you greater control and flexibility while working with data.
Execution Order of Validations
These validation types are executed in the following order:
- Data-type based validation: Data type validation is applied when an XForm is loaded and data is rendered in it.
- Server side validation: Server side validation is applied when the data is rendered, after the client-side validations are applied.
- Custom validation: Custom validation is applied when you change data in an XForm. Only if the modified data is valid, the onchange event is fired for the control.
Additionally, all validations are also executed before synchronizing data with the backend. If any validation fails, no data is saved to the backend.
Validation Messages
Messages regarding failed validations display as notification messages or error messages
Notification messages display in case of failure of data-type based validations and custom validations. An error message displays in case of failure of server side validations or if any type of validation fails when saving data to backend.
Process Platform supports the customization of the following error message types:
System error messages: These refer to default messages that display when a specific activity is performed on the XForm, such as closing an XForm without saving data.
Validation error messages: These refer to validation messages that display for formatting and validation inconsistencies.
As validation errors can occur for various reasons in different scenarios, application users expect to see validation messages specific to their situation. To achieve this, you can customize error messages and notification messages as relevant to your application. For information about the customization of validation messages, see Customizing Validation Messages.